import { h, mergeProps, withCtx, renderSlot } from 'vue'
import Modal from './Modal.vue'
export default function createModalComponent(ContentComp, ButtonComp) {
  return {
    name: 'Modal',
    props: Modal.props,
    emits: Modal.emits,
    render(ctx) {
      return h(Modal, mergeProps(ctx.$props, {
        onOpen: () => {
          ctx.$emit('open')
        },
        onClose: () => {
          ctx.$emit('close')
        }
      }, {
        default: withCtx(() => {
          return [ContentComp || renderSlot(ctx.$slots, 'content')]
        }),
        button: withCtx(() => {
          return [ButtonComp || renderSlot(ctx.$slots, 'button')]
        })
      }))
    }
  }
}
